package com.atguigu.stgy.app.controller;

import com.atguigu.stgy.app.service.RoomInfoService;
import com.atguigu.stgy.model.dto.ApartmentSearchDTO;
import com.atguigu.stgy.model.dto.RoomDTO;
import com.atguigu.stgy.model.dto.RoomInfoSearchDTO;
import com.atguigu.stgy.model.dto.RoomListSearchDTO;
import com.atguigu.stgy.model.entity.RoomInfo;
import com.atguigu.stgy.model.result.R;
import com.atguigu.stgy.model.vo.RoomDetailVO;
import com.atguigu.stgy.model.vo.RoomInfoVO;
import com.atguigu.stgy.model.vo.RoomListVO;
import com.atguigu.stgy.model.vo.RoomVO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 房间信息表(room_info)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/app/room")
public class RoomInfoController {
    /**
     * 服务对象
     */
    @Resource
    private RoomInfoService roomInfoService;
    ///app/room/pageItemByApartmentId?id=10&current=1&size=10
    @Operation(summary = "查询公寓下的房屋分页列表")
    ///app/room/pageItem
    @GetMapping("pageItemByApartmentId")
    public R<Page<RoomListVO>> pageItemByApartmentId(RoomListSearchDTO searchDTO){
        Page<RoomListVO> page = roomInfoService.pageItemByApartmentId(searchDTO);
        return R.ok(page);
    }
    @Operation(summary = "查询房屋详情")
    ///app/room/pageItem
    @GetMapping("getDetailById")
    public R<RoomDetailVO> getDetailById(@RequestParam("id")Long id){
        RoomDetailVO roomDetailVO = roomInfoService.getDetailById(id);
        return R.ok(roomDetailVO);
    }
    @Operation(summary = "条件查询房屋分页列表")
    ///app/room/pageItem
    @GetMapping("pageItem")
    public R<Page<RoomInfoVO>> pageItem(RoomInfoSearchDTO searchDTO){
        Page<RoomInfoVO> roomInfoVOPage = roomInfoService.pageItem(searchDTO);
        return R.ok(roomInfoVOPage);
    }






}
